<?php
if (1)
{
	echo '111';
    /*------------------------------------------------------ */
    //-- 
    /*------------------------------------------------------ */
    include('includes/cls_json.php');

    $address_id = intval($_POST['address_id'])>0?intval($_POST['address_id']):0;
	$consignee = array(
		'address_id'    => empty($_POST['address_id']) ? 0  :   intval($_POST['address_id']),
		'consignee'     => empty($_POST['consignee'])  ? '' :   compile_str(trim($_POST['consignee'])),
		'country'       => empty($_POST['country'])    ? '' :   intval($_POST['country']),
		'province'      => empty($_POST['province'])   ? '' :   intval($_POST['province']),
		'city'          => empty($_POST['city'])       ? '' :   intval($_POST['city']),
		'district'      => empty($_POST['district'])   ? '' :   intval($_POST['district']),
		'email'         => empty($_POST['email'])      ? '' :   compile_str($_POST['email']),
		'address'       => empty($_POST['address'])    ? '' :   compile_str($_POST['address']),
		'zipcode'       => empty($_POST['zipcode'])    ? '' :   compile_str(make_semiangle(trim($_POST['zipcode']))),
		'tel'           => empty($_POST['tel'])        ? '' :   compile_str(make_semiangle(trim($_POST['tel']))),
		'mobile'        => empty($_POST['mobile'])     ? '' :   compile_str(make_semiangle(trim($_POST['mobile']))),
		'sign_building' => empty($_POST['sign_building']) ? '' :compile_str($_POST['sign_building']),
		'best_time'     => empty($_POST['best_time'])  ? '' :   compile_str($_POST['best_time']),
	);


	$sql="update ".$ecs->table("users")." set address_id='$address_id'  where user_id='".$_SESSION['user_id']."'";

	$json   = new JSON;
    $res    = array('err_msg' => '', 'result' => '');

    if ($db->query($sql))
    {
		$_SESSION['flow_consignee']='';
		$consignee = get_consignee($_SESSION['user_id']);

    	$_SESSION['flow_consignee'] = $consignee;
       	$res['result'] =true;
    }
	else
	{
		$res['result'] =false;	
	}
	
	die($json->encode($res));

}